<!doctype html>
<html lang="en">

<head>
	<title>Home</title>
	{%include file="public/head_common" /%}
	<link rel="stylesheet" href="__STATIC__/assets/css/plug.css">
</head>

<body>
	<div class="main" id="app">
		<div class="main-content">
			<ul class="breadcrumb">
			    <li>账号管理</li>
			    <li>访问列表</li>
			</ul>
			<div class="container-fluid">
				<div class="row" style="margin-bottom: 10px;">
					<form class="form-inline">
					    <input type="text" class="form-control" v-model="search.acct_name" placeholder="账号">
					    <button type="button" class="btn btn-primary" @click="getList()">查询</button>
					</form>
				</div>
				<!-- 数据开始-->
				<div class="row">
					<table class="table table-hover">
						<thead>
							<tr>
								<th>ID</th>
								<th>页面</th>
								<th>账号</th>
								<th>添加时间</th>
							</tr>
						</thead>
						<tbody>
							<tr v-for="row in rows">
								<td>{{ row.id }}</td>
								<td>{{ row.controller }} -> {{ row.action }}</td>
								<td>{{ row.name }}</td>
								<td>{{ row.add_time }}</td>
							</tr>
						</tbody>
					</table>
					<div id="pageBar">
						<vue-page :total_page='total_page' :cur_page='cur_page' @do-page='getList'></vue-page>
					</div>
				</div>		
			</div>
		</div>
	</div>
	<script src="__STATIC__/assets/vendor/jquery/jquery.min.js"></script>
	<script src="__STATIC__/assets/vendor/vue.js"></script>
	<script src="__STATIC__/components/vue-page.js"></script>
	<script type="text/javascript">
		var vm = new Vue({
			el: '#app',
			data: {
				search: {
					acct_name: ''
				},
				rows: [],
				total_page: 0,
				cur_page: 1
			},
			components: {
				'vue-page': vuePage
			},
			created: function(){
				this.getList();
			},
			methods:{
				getList: function(page=1){
					var _this = this;
					var data = this.search;
					$.post("{%:url('Account/getPageLoglist')%}?page=" + page,data,function(rsp){
						_this.rows = rsp.data.rows;
						_this.total_page = rsp.data.total_page;
						_this.cur_page = Number(rsp.data.page);
					},'json')
				}
			}
		});		
	</script>
</body>

</html>